﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Demo.Util
{
    public partial class KeyboardApiDemo : Form
    {
        public KeyboardApiDemo()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Cocon90.Lib.Util.Window.Hook.KeyboardApi kapi = new Cocon90.Lib.Util.Window.Hook.KeyboardApi();
            kapi.KeyboardEvent += kapi_KeyboardEvent;
            kapi.SetHook();
        }

        void kapi_KeyboardEvent(Cocon90.Lib.Util.Window.Hook.KeyboardApi.KeyboardEvents keyEvent, Keys key)
        {
            switch (keyEvent)
            {
                case Cocon90.Lib.Util.Window.Hook.KeyboardApi.KeyboardEvents.KeyDown:

                    richTextBox1.Text += key;

                    break;
                case Cocon90.Lib.Util.Window.Hook.KeyboardApi.KeyboardEvents.KeyUp:
                    break;
                case Cocon90.Lib.Util.Window.Hook.KeyboardApi.KeyboardEvents.SystemKeyDown:
                    break;
                case Cocon90.Lib.Util.Window.Hook.KeyboardApi.KeyboardEvents.SystemKeyUp:
                    break;
                default:
                    break;
            }
        }
    }
}
